package com.taihe.scheduled;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * Created by zwt on 2018/7/23.
 * spring boot 中使用定时任务
 *@Configuration 注解可以理解为 xml文件中的<beans><beans/>的用法
 * @Bean 可以理解为<bean><bean/>的用法
 */
@Configuration
//@EnableScheduling
public class SpringBootScheduledTest {

    @Scheduled(cron = "0/2 * * * * ?")
    public void test(){
        System.out.println("2秒执行一次");
    }
}
